package com.lahuan.config.pulsar;

import com.lahuan.demo.entity.Order;
import io.github.majusko.pulsar.producer.PulsarTemplate;
import org.apache.pulsar.client.api.PulsarClientException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class PulsarProducer {
    @Autowired
    private PulsarTemplate template;

    public void send(Order message) {
        try {
            template.send("my-topic", message);
        } catch (PulsarClientException e) {
            e.printStackTrace();
        }
    }
}